package arrays

func Sum(numbers []int) (sum int) {
	for _, number := range numbers {
		sum += number
	}
	return
}

func SumAll(numbersToSum ...[]int) (sums []int) {
	//length := len(numbersToSum)
	//sums = make([]int, length)
	//for i, numbers := range numbersToSum {
	//	sums[i] = Sum(numbers)
	//}
	for _, numbers := range numbersToSum {
		sums = append(sums, Sum(numbers))
	}
	return
}

func SumAllTails(numbersToSum ...[]int) (sums []int) {
	for _, numbers := range numbersToSum {
		var tails []int
		if len(numbers) > 0{
			tails = numbers[1:]
		}

		sums = append(sums, Sum(tails))
	}
	return
}